package com.tydic.system.controller.system;

import com.tydic.common.web.core.BaseController;
import com.tydic.system.domain.vo.TreeDataVo;
import com.tydic.system.service.ISysDictDataService;
import com.tydic.system.service.ISysDictTypeService;
import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据字典信息
 *
 * @author Lion Li
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/sys/dictData")
public class SysDictDataController extends BaseController {

    private final ISysDictDataService dictDataService;
    private final ISysDictTypeService dictTypeService;

    /**
     * 字典值列表
     *
     * @param dictType
     * @return
     */
    @GetMapping("/treeData")
    public List<TreeDataVo> treeData(@NotBlank(message = "字典类型不能为空") String dictType) {
        return dictDataService.treeData(dictType);
    }
}
